package mains;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import cartes.Carte;

import junit.framework.TestSuite;

import cartes.Tests.*;
import mains.Tests.*;

public class Main {
	private RangPoker rang;
	private Collection<Carte> cartes = new ArrayList<Carte>();

	public Main() {
	}

	public boolean add(Carte c) {
		return cartes.add(c);
	}
        
        public boolean remove(Carte c) {
		return cartes.remove(c);
	}
        
        public int size() {
		return cartes.size();
	}
        
        public Carte first() {
		return cartes.iterator().next();
	}

	public Iterator<Carte> iterator() {
		return cartes.iterator();
	}
        
        public Collection<Carte> getCartes() {
		return cartes;
	}
        
        public RangPoker getRangPoker() {
		return rang;
	}
        
        public void setRangPoker(RangPoker rang) {
		this.rang = rang;
	}
        
        public boolean estValide() {
            if(cartes.size() <= 0)
		return false;
            else return true;
        }
       
	public int compareTo(Main m) 
        {
            if(getRangPoker() == null)
            {
                setRangPoker(RangPoker.getRang(this));
            }
            if(m.getRangPoker() == null)
            {
                m.setRangPoker(RangPoker.getRang(m));   
            }
            return rang.compareTo(m.getRangPoker());
	}

		

	public static void main(String[] args) {
		System.out.println("Ready");

		TestSuite suite = new TestSuite();
		suite.addTestSuite(CarteTest.class);
		suite.addTestSuite(DenominationTest.class);
		suite.addTestSuite(CouleurCarteTest.class);

                suite.addTestSuite(AbstractAnalyseurRangTest.class);
		suite.addTestSuite(CouleurTest.class);
		suite.addTestSuite(QuinteTest.class);
		suite.addTestSuite(QuinteCouleurTest.class);
		suite.addTestSuite(CarreTest.class);
		suite.addTestSuite(MainPleineTest.class);
		suite.addTestSuite(CarreTest.class);
		suite.addTestSuite(MainTest.class);
		suite.addTestSuite(QuinteRoyaleTest.class);
		suite.addTestSuite(QuintupletTest.class);
		suite.addTestSuite(RangPokerTest.class);

		junit.textui.TestRunner.run(suite);

	}
}
